<script src="../view/admin/js/webshop/product.js" type="text/javascript"></script>
<script src="../view/admin/js/popup.js" type="text/javascript"></script>
<div id="preview_div" style="display: none; z-index: 110; position: absolute;"></div>
<div id="preview_div_desc" style="display: none; z-index: 110; position: absolute;"></div>
<div class="wrap">
	<h2>Produkte des Men&uuml;s "{$CATNAME->cat_name}" zuweisen</h2>
	<form name="assign" id="assign" method="post" action="?{$smarty.server.QUERY_STRING}">
		<input type="hidden" id="act" name="act" value="assign_product"/>
        <input type="hidden" name="catparent" value="{$smarty.get.catid}"/>
		<input type="hidden" id="cat_id" name="cat_id" value="{$smarty.get.id}"/>
				<div class="box">
					<div class="box-content treeview">
		  				{foreach from=$ALLPRODUCTLIST key=p item=item}
		  				<div id="list_product_{$item->product_group_id}">
                        		<img src="../view/admin/images/closed.png" alt="Create" class="left" id="iconclose_{$item->product_group_id}" onclick="toggleSub('?{$smarty.server.QUERY_STRING}','assign_{$item->product_group_id}','iconclose_{$item->product_group_id}','../view/admin/images/expanded.png','../view/admin/images/closed.png','{$item->product_group_id}','{$smarty.get.id}','group_{$item->product_group_id}','sum_{$item->product_group_id}')"/>
                                <input type="hidden" id="sum_{$item->product_group_id}" name="sum_{$item->product_group_id}" value=""/>
                                <input type="hidden" id="exists_{$item->product_group_id}" name="exists_{$item->product_group_id}" value="{$item->active_product_group}"/>
								<input type="checkbox" {if $item->active_product_group !=NULL} checked="checked" {/if} name="group_{$item->product_group_id}" value="{$item->product_group_id}" onclick="checkedAllGroup('assign_{$item->product_group_id}',this)" id="group_{$item->product_group_id}"/>
									<span class="point" onclick="toggleSub('?{$smarty.server.QUERY_STRING}','assign_{$item->product_group_id}','iconclose_{$item->product_group_id}','../view/admin/images/expanded.png','../view/admin/images/closed.png','{$item->product_group_id}','{$smarty.get.id}','group_{$item->product_group_id}','sum_{$item->product_group_id}')">{$item->product_group_name}</span><br />
                                  
                                 <div id="assign_{$item->product_group_id}" class="assignopen" style="display: none;">
                                 </div>
								 <div class="clear"></div> 	
                           </div>
						{/foreach}
	<p class="submit" align="right">
		<input type="image" name="submit" src="../view/admin/images/object_save.png" value="" />
	</p>
	</form>
<script language="javascript">
{literal}
	checked = true;
	function checkedGroup(groupid,product,frm){
		var group= document.getElementById(groupid);
		var form= document.getElementById(frm);
		formcheck = form.getElementsByTagName('input');
		var dem = 0;
		for (var i =0; i < formcheck.length; i++){
				if(formcheck[i].checked == true)
					dem++;
		}
		if(dem == 0)
			group.checked = false;
		else	
			group.checked = true;
	}
    function checkedAllGroup(frm1,checkgrid){
		var form= document.getElementById(frm1);
		formcheck = form.getElementsByTagName('input');
		if(checkgrid.checked != false)
			checked = false;
		else
			checked = true;	
		
	    if (checked == false)
           checked = true;
        else
          checked = false;
		for (var i =0; i < formcheck.length; i++){
				formcheck[i].checked = checked;
		}
	}
{/literal}	  
</script>   